<template>
	<view class="home">
		<view class="swiperbg">
			<ty-swiper-home :list="detail.carousel_images" height='360'></ty-swiper-home>
		</view>
		<view class="flex margin-top-40">
			<view class="flex-one text-32 text-bold">{{detail.title}}</view>
			<view class="text-32 text-bold">￥{{detail.deposit}}/人/小时</view>
		</view>
		<view class="margin-top-10 text-24 text-66 margin-top-10">桌游主题:空(预约后或拼桌后点击可修改)</view>
		<view class="flex align-center margin-top-40 justify-between">
			<view class="flex flex-direction">
				<view class="flex">
					<view class="text-30 text-bold position-relative">
						玩家信息
						<image src="/static/board/xing.png" mode="" class="xingimg"></image>
					</view>
				</view>
				<image src="/static/board/line.png" mode="" class="lineimg"></image>
			</view>
			<view class="">可接受拼桌{{detail.left_count}}人</view>
		</view>
		<view class="wjbg position-relative">
			<image src="/static/board/wjbg.png" mode="" class="wjimg position-absolute"></image>
			<view class="position-relative wjcont">
				<view class="text-28 text-bold">当前正在玩：{{detail.occupied_count}}人</view>
				<view class="text-28 text-bold"> （预约中{{detail.reserved_count}}人）</view>
				<view class="text-28 text-bold">可拼桌：{{detail.free_count}}人</view>
			</view>
			<view class="player1" v-if="detail.occupants_info[0]">
				<view class="width-100p height-100p position-relative" v-if="detail.occupants_info[0].status=='正在使用'">
					<image :src="detail.occupants_info[0].user_info.user.avatar" mode="" class="headimg"></image>
					<image src="/static/board/g-nan.png" mode="" class="playerg"
						v-if="detail.occupants_info[0].user_info.user.gender==1"></image>
					<image src="/static/board/g-nv.png" mode="" class="playerg"
						v-if="detail.occupants_info[0].user_info.user.gender==0"></image>
				</view>
				<view class="flex align-center flex-direction width-100p height-100p justify-center radius-50p"
					style="background: #545454;" v-if="detail.occupants_info[0].status=='已预约'">
					<image src="/static/board/time.png" mode="" class="timeimg"></image>
					<view class="text-ff text-24">预约</view>
				</view>
				<view class="flex align-center flex-direction width-100p height-100p justify-center radius-50p"
					v-if="detail.occupants_info[0].status=='空闲'">
					<view class="text-ff text-24">空闲</view>
				</view>
			</view>
			<view class="player2" v-if="detail.occupants_info[1]">
				<view class="width-100p height-100p position-relative" v-if="detail.occupants_info[1].status=='正在使用'">
					<image :src="detail.occupants_info[1].user_info.user.avatar" mode="" class="headimg"></image>
					<image src="/static/board/g-nan.png" mode="" class="playerg"
						v-if="detail.occupants_info[1].user_info.user.gender==1"></image>
					<image src="/static/board/g-nv.png" mode="" class="playerg"
						v-if="detail.occupants_info[1].user_info.user.gender==0"></image>
				</view>
				<view class="flex align-center flex-direction width-100p height-100p justify-center radius-50p"
					style="background: #545454;" v-if="detail.occupants_info[1].status=='已预约'">
					<image src="/static/board/time.png" mode="" class="timeimg"></image>
					<view class="text-ff text-24">预约</view>
				</view>
				<view class="flex align-center flex-direction width-100p height-100p justify-center radius-50p"
					v-if="detail.occupants_info[1].status=='空闲'">
					<view class="text-ff text-24">空闲</view>
				</view>
			</view>
			<view class="player3" v-if="detail.occupants_info[2]">
				<view class="width-100p height-100p position-relative" v-if="detail.occupants_info[2].status=='正在使用'">
					<image :src="detail.occupants_info[2].user_info.user.avatar" mode="" class="headimg"></image>
					<image src="/static/board/g-nan.png" mode="" class="playerg"
						v-if="detail.occupants_info[2].user_info.user.gender==1"></image>
					<image src="/static/board/g-nv.png" mode="" class="playerg"
						v-if="detail.occupants_info[2].user_info.user.gender==0"></image>
				</view>
				<view class="flex align-center flex-direction width-100p height-100p justify-center radius-50p"
					style="background: #545454;" v-if="detail.occupants_info[2].status=='已预约'">
					<image src="/static/board/time.png" mode="" class="timeimg"></image>
					<view class="text-ff text-24">预约</view>
				</view>
				<view class="flex align-center flex-direction width-100p height-100p justify-center radius-50p"
					v-if="detail.occupants_info[2].status=='空闲'">
					<view class="text-ff text-24">空闲</view>
				</view>
			</view>

			<view class="player4" v-if="detail.occupants_info[3]">
				<view class="width-100p height-100p position-relative" v-if="detail.occupants_info[3].status=='正在使用'">
					<image :src="detail.occupants_info[3].user_info.user.avatar" mode="" class="headimg"></image>
					<image src="/static/board/g-nan.png" mode="" class="playerg"
						v-if="detail.occupants_info[3].user_info.user.gender==1"></image>
					<image src="/static/board/g-nv.png" mode="" class="playerg"
						v-if="detail.occupants_info[3].user_info.user.gender==0"></image>
				</view>
				<view class="flex align-center flex-direction width-100p height-100p justify-center radius-50p"
					style="background: #545454;" v-if="detail.occupants_info[3].status=='已预约'">
					<image src="/static/board/time.png" mode="" class="timeimg"></image>
					<view class="text-ff text-24">预约</view>
				</view>
				<view class="flex align-center flex-direction width-100p height-100p justify-center radius-50p"
					v-if="detail.occupants_info[3].status=='空闲'">
					<view class="text-ff text-24">空闲</view>
				</view>
			</view>
			<view class="player5" v-if="detail.occupants_info[4]">
				<view class="width-100p height-100p position-relative" v-if="detail.occupants_info[4].status=='正在使用'">
					<image :src="detail.occupants_info[4].user_info.user.avatar" mode="" class="headimg"></image>
					<image src="/static/board/g-nan.png" mode="" class="playerg"
						v-if="detail.occupants_info[4].user_info.user.gender==1"></image>
					<image src="/static/board/g-nv.png" mode="" class="playerg"
						v-if="detail.occupants_info[4].user_info.user.gender==0"></image>
				</view>
				<view class="flex align-center flex-direction width-100p height-100p justify-center radius-50p"
					style="background: #545454;" v-if="detail.occupants_info[4].status=='已预约'">
					<image src="/static/board/time.png" mode="" class="timeimg"></image>
					<view class="text-ff text-24">预约</view>
				</view>
				<view class="flex align-center flex-direction width-100p height-100p justify-center radius-50p"
					v-if="detail.occupants_info[4].status=='空闲'">
					<view class="text-ff text-24">空闲</view>
				</view>
			</view>
			<view class="player6" v-if="detail.occupants_info[5]">
				<view class="width-100p height-100p position-relative" v-if="detail.occupants_info[5].status=='正在使用'">
					<image :src="detail.occupants_info[5].user_info.user.avatar" mode="" class="headimg"></image>
					<image src="/static/board/g-nan.png" mode="" class="playerg"
						v-if="detail.occupants_info[5].user_info.user.gender==1"></image>
					<image src="/static/board/g-nv.png" mode="" class="playerg"
						v-if="detail.occupants_info[5].user_info.user.gender==0"></image>
				</view>
				<view class="flex align-center flex-direction width-100p height-100p justify-center radius-50p"
					style="background: #545454;" v-if="detail.occupants_info[5].status=='已预约'">
					<image src="/static/board/time.png" mode="" class="timeimg"></image>
					<view class="text-ff text-24">预约</view>
				</view>
				<view class="flex align-center flex-direction width-100p height-100p justify-center radius-50p"
					v-if="detail.occupants_info[5].status=='空闲'">
					<view class="text-ff text-24">空闲</view>
				</view>
			</view>
			<view class="player7" v-if="detail.occupants_info[6]">
				<view class="width-100p height-100p position-relative" v-if="detail.occupants_info[6].status=='正在使用'">
					<image :src="detail.occupants_info[6].user_info.user.avatar" mode="" class="headimg"></image>
					<image src="/static/board/g-nan.png" mode="" class="playerg"
						v-if="detail.occupants_info[6].user_info.user.gender==1"></image>
					<image src="/static/board/g-nv.png" mode="" class="playerg"
						v-if="detail.occupants_info[6].user_info.user.gender==0"></image>
				</view>
				<view class="flex align-center flex-direction width-100p height-100p justify-center radius-50p"
					style="background: #545454;" v-if="detail.occupants_info[6].status=='已预约'">
					<image src="/static/board/time.png" mode="" class="timeimg"></image>
					<view class="text-ff text-24">预约</view>
				</view>
				<view class="flex align-center flex-direction width-100p height-100p justify-center radius-50p"
					v-if="detail.occupants_info[6].status=='空闲'">
					<view class="text-ff text-24">空闲</view>
				</view>
			</view>
			<view class="player8" v-if="detail.occupants_info[7]">
				<view class="width-100p height-100p position-relative" v-if="detail.occupants_info[7].status=='正在使用'">
					<image :src="detail.occupants_info[7].user_info.user.avatar" mode="" class="headimg"></image>
					<image src="/static/board/g-nan.png" mode="" class="playerg"
						v-if="detail.occupants_info[7].user_info.user.gender==1"></image>
					<image src="/static/board/g-nv.png" mode="" class="playerg"
						v-if="detail.occupants_info[7].user_info.user.gender==0"></image>
				</view>
				<view class="flex align-center flex-direction width-100p height-100p justify-center radius-50p"
					style="background: #545454;" v-if="detail.occupants_info[7].status=='已预约'">
					<image src="/static/board/time.png" mode="" class="timeimg"></image>
					<view class="text-ff text-24">预约</view>
				</view>
				<view class="flex align-center flex-direction width-100p height-100p justify-center radius-50p"
					v-if="detail.occupants_info[7].status=='空闲'">
					<view class="text-ff text-24">空闲</view>
				</view>
			</view>
			<view class="player9" v-if="detail.occupants_info[8]">
				<view class="width-100p height-100p position-relative" v-if="detail.occupants_info[8].status=='正在使用'">
					<image :src="detail.occupants_info[8].user_info.user.avatar" mode="" class="headimg"></image>
					<image src="/static/board/g-nan.png" mode="" class="playerg"
						v-if="detail.occupants_info[8].user_info.user.gender==1"></image>
					<image src="/static/board/g-nv.png" mode="" class="playerg"
						v-if="detail.occupants_info[8].user_info.user.gender==0"></image>
				</view>
				<view class="flex align-center flex-direction width-100p height-100p justify-center radius-50p"
					style="background: #545454;" v-if="detail.occupants_info[8].status=='已预约'">
					<image src="/static/board/time.png" mode="" class="timeimg"></image>
					<view class="text-ff text-24">预约</view>
				</view>
				<view class="flex align-center flex-direction width-100p height-100p justify-center radius-50p"
					v-if="detail.occupants_info[8].status=='空闲'">
					<view class="text-ff text-24">空闲</view>
				</view>
			</view>
			<view class="player10" v-if="detail.occupants_info[9]">
				<view class="width-100p height-100p position-relative" v-if="detail.occupants_info[9].status=='正在使用'">
					<image :src="detail.occupants_info[9].user_info.user.avatar" mode="" class="headimg"></image>
					<image src="/static/board/g-nan.png" mode="" class="playerg"
						v-if="detail.occupants_info[9].user_info.user.gender==1"></image>
					<image src="/static/board/g-nv.png" mode="" class="playerg"
						v-if="detail.occupants_info[9].user_info.user.gender==0"></image>
				</view>
				<view class="flex align-center flex-direction width-100p height-100p justify-center radius-50p"
					style="background: #545454;" v-if="detail.occupants_info[9].status=='已预约'">
					<image src="/static/board/time.png" mode="" class="timeimg"></image>
					<view class="text-ff text-24">预约</view>
				</view>
				<view class="flex align-center flex-direction width-100p height-100p justify-center radius-50p"
					v-if="detail.occupants_info[9].status=='空闲'">
					<view class="text-ff text-24">空闲</view>
				</view>
			</view>
			<view class="player11" v-if="detail.occupants_info[10]">
				<view class="width-100p height-100p position-relative" v-if="detail.occupants_info[10].status=='正在使用'">
					<image :src="detail.occupants_info[10].user_info.user.avatar" mode="" class="headimg"></image>
					<image src="/static/board/g-nan.png" mode="" class="playerg"
						v-if="detail.occupants_info[10].user_info.user.gender==1"></image>
					<image src="/static/board/g-nv.png" mode="" class="playerg"
						v-if="detail.occupants_info[10].user_info.user.gender==0"></image>
				</view>
				<view class="flex align-center flex-direction width-100p height-100p justify-center radius-50p"
					style="background: #545454;" v-if="detail.occupants_info[10].status=='已预约'">
					<image src="/static/board/time.png" mode="" class="timeimg"></image>
					<view class="text-ff text-24">预约</view>
				</view>
				<view class="flex align-center flex-direction width-100p height-100p justify-center radius-50p"
					v-if="detail.occupants_info[10].status=='空闲'">
					<view class="text-ff text-24">空闲</view>
				</view>
			</view>
			<view class="player12" v-if="detail.occupants_info[11]">
				<view class="width-100p height-100p position-relative" v-if="detail.occupants_info[11].status=='正在使用'">
					<image :src="detail.occupants_info[11].user_info.user.avatar" mode="" class="headimg"></image>
					<image src="/static/board/g-nan.png" mode="" class="playerg"
						v-if="detail.occupants_info[11].user_info.user.gender==1"></image>
					<image src="/static/board/g-nv.png" mode="" class="playerg"
						v-if="detail.occupants_info[11].user_info.user.gender==0"></image>
				</view>
				<view class="flex align-center flex-direction width-100p height-100p justify-center radius-50p"
					style="background: #545454;" v-if="detail.occupants_info[11].status=='已预约'">
					<image src="/static/board/time.png" mode="" class="timeimg"></image>
					<view class="text-ff text-24">预约</view>
				</view>
				<view class="flex align-center flex-direction width-100p height-100p justify-center radius-50p"
					v-if="detail.occupants_info[11].status=='空闲'">
					<view class="text-ff text-24">空闲</view>
				</view>
			</view>
		</view>
		<view class="text-24 text-66 text-center">说明:预约时收取1小时的费用作为押金</view>
		<view class="text-24 text-66 text-center margin-top-5">等结束游玩后按实际时间计费，费用多除少补</view>
		<view class="subbtn" @click="getJt" v-if="type=='order'">开始计时</view>
		<view class="subbtn" @click="quebtn" v-else>确认选择</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id: "",
				shop_id: "",
				detail: "",
				type: ""
			}
		},
		onLoad(options) {
			this.id = options.id
			this.shop_id = options.shop_id
			this.type = options.type ? options.type : ''
			if(options.tn==0){
				uni.setNavigationBarTitle({
					title:'包间详情'
				})
			}else{
				uni.setNavigationBarTitle({
					title:'大厅详情'
				})
			}
		},
		onReady() {
			this.rq.getData('room/room_info', {
				id: this.id,
				shop_id: this.shop_id,
				start_time: uni.getStorageSync('stroom') ? uni.getStorageSync('stroom') : '',
				end_time: uni.getStorageSync('edroom') ? uni.getStorageSync('edroom') : ''
			}).then(res => {
				if (res.code == 1) {
					this.detail = res.data
				}
			})
		},
		methods: {
			quebtn() {
				uni.setStorageSync('room_id', this.detail.id)
				uni.setStorageSync('room_title', this.detail.title)
				uni.setStorageSync('room_deposit', this.detail.deposit)
				uni.navigateBack({
					delta: 2
				})
			},
			getJt() {
				var that = this
				if (that.detail.shared_table > 0) {
					uni.showModal({
						content: '是否确认开始计时?',
						cancelText: '取消',
						cancelColor: "#727272",
						confirmText: "开始计时",
						confirmColor: '#111111',
						success: function(res) {
							if (res.confirm) {
								that.rq.getData('order/join_room', {
									room_id: that.detail.id,
									lights_id: uni.getStorageSync('lampid'),
								}).then(res => {
									if (res.code == 1) {
										uni.navigateTo({
											url: '/pages/board/orderdetail?id=' + res.data.id+'&type=2'
										})
									}
								})
							} else if (res.cancel) {

							}
						}
					})
				} else {
					uni.showModal({
						content: '该包间不可接受拼桌 是否确认开始计时?',
						cancelText: '取消',
						cancelColor: "#727272",
						confirmText: "开始计时",
						confirmColor: '#111111',
						success: function(res) {
							if (res.confirm) {
								that.rq.getData('order/join_room', {
									room_id: that.detail.id,
									lights_id: uni.getStorageSync('lampid'),
								}).then(res => {
									if (res.code == 1) {
										uni.navigateTo({
											url: '/pages/board/orderdetail?id=' + res.data.id+'&type=2'
										})
									}
								})
							} else if (res.cancel) {

							}
						}
					})
				}
			}
		}
	}
</script>

<style>
	.home {
		width: 100%;
		min-height: 100vh;
		background: #fff;
		padding: 30rpx 30rpx 80rpx;
		overflow: hidden;
	}

	.swiperbg {
		width: 100%;
		height: 360rpx;
	}

	.zyjimg {
		width: 110rpx;
		height: 45rpx;
	}

	.xingimg {
		width: 20rpx;
		height: 20rpx;
		position: absolute;
		top: -5rpx;
		right: -25rpx;
	}

	.lineimg {
		width: 76rpx;
		height: 10rpx;
	}

	/* 玩家信息 */
	.wjbg {
		width: 494rpx;
		height: 494rpx;
		margin: 94rpx auto;
		position: relative;
	}

	.wjcont {
		width: 494rpx;
		height: 494rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		flex-direction: column;
	}

	.wjimg {
		width: 604rpx !important;
		height: 604rpx !important;
		position: absolute;
		top: -55rpx;
		left: -55rpx;
	}

	.player1 {
		width: 100rpx;
		height: 100rpx;
		background: #101010;
		border-radius: 50%;
		position: absolute;
		top: -36rpx;
		left: 204rpx;
	}

	.player2 {
		width: 100rpx;
		height: 100rpx;
		background: #101010;
		border-radius: 50%;
		position: absolute;
		top: -4rpx;
		left: 74rpx;
	}

	.player3 {
		width: 100rpx;
		height: 100rpx;
		background: #101010;
		border-radius: 50%;
		position: absolute;
		top: 88rpx;
		left: -26rpx;
	}

	.player4 {
		width: 100rpx;
		height: 100rpx;
		background: #101010;
		border-radius: 50%;
		position: absolute;
		top: 206rpx;
		left: -40rpx;
	}

	.player5 {
		width: 100rpx;
		height: 100rpx;
		background: #101010;
		border-radius: 50%;
		position: absolute;
		top: 324rpx;
		left: -26rpx;
	}

	.player6 {
		width: 100rpx;
		height: 100rpx;
		background: #101010;
		border-radius: 50%;
		position: absolute;
		bottom: -18rpx;
		left: 74rpx;
	}

	.player7 {
		width: 100rpx;
		height: 100rpx;
		background: #101010;
		border-radius: 50%;
		position: absolute;
		bottom: -42rpx;
		left: 204rpx;
	}

	.player8 {
		width: 100rpx;
		height: 100rpx;
		background: #101010;
		border-radius: 50%;
		position: absolute;
		bottom: -18rpx;
		right: 62rpx;
	}

	.player9 {
		width: 100rpx;
		height: 100rpx;
		background: #101010;
		border-radius: 50%;
		position: absolute;
		bottom: 70rpx;
		right: -16rpx;
	}

	.player10 {
		width: 100rpx;
		height: 100rpx;
		background: #101010;
		border-radius: 50%;
		position: absolute;
		top: 206rpx;
		right: -44rpx;
	}

	.player11 {
		width: 100rpx;
		height: 100rpx;
		background: #101010;
		border-radius: 50%;
		position: absolute;
		top: 88rpx;
		right: -16rpx;
	}

	.player12 {
		width: 100rpx;
		height: 100rpx;
		background: #101010;
		border-radius: 50%;
		position: absolute;
		top: -4rpx;
		right: 62rpx;
	}

	.playerg {
		width: 21.88rpx;
		height: 21.88rpx;
		position: absolute;
		right: 4rpx;
		bottom: 8rpx;
	}

	.timeimg {
		width: 40rpx;
		height: 40rpx;
	}

	.headimg {
		width: 100rpx;
		height: 100rpx;
		border-radius: 50%;
	}

	.subbtn {
		width: 690rpx;
		height: 88rpx;
		background: #101010;
		box-shadow: 0rpx 16rpx 80rpx 0rpx rgba(66, 66, 67, 0.25);
		border-radius: 200rpx 200rpx 200rpx 200rpx;
		font-size: 32rpx;
		color: #FFFFFF;
		line-height: 88rpx;
		text-align: center;
		margin: 112rpx auto 0;
	}
</style>